using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class VoucherHistory: IEquatable<VoucherHistory>
	{

		#region Private Members

		private long _id; 
		private string _voucher_no; 
		private string _invoice_no; 
		private DateTime? _date_create; 
		private string _status; 
		private double _incoming_usd; 
		private double _outgoing_usd; 
		private double _incoming_vnd; 
		private double _outgoing_vnd; 
		private string _remark; 
		private string _user_id; 
		private DateTime? _date_input; 		
		#endregion

		#region Constructor

		public VoucherHistory()
		{
			_id = 0; 
			_voucher_no = String.Empty; 
			_invoice_no = String.Empty; 
			_date_create = new DateTime?(); 
			_status = String.Empty; 
			_incoming_usd = new double(); 
			_outgoing_usd = new double(); 
			_incoming_vnd = new double(); 
			_outgoing_vnd = new double(); 
			_remark = String.Empty; 
			_user_id = String.Empty; 
			_date_input = new DateTime?(); 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public VoucherHistory(
			long id)
			: this()
		{
			_id = id;
			_voucher_no = String.Empty;
			_invoice_no = String.Empty;
			_date_create = null;
			_status = String.Empty;
			_incoming_usd = 0;
			_outgoing_usd = 0;
			_incoming_vnd = 0;
			_outgoing_vnd = 0;
			_remark = String.Empty;
			_user_id = String.Empty;
			_date_input = null;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual long Id
		{
			get
			{ 
				return _id;
			}
			set
			{
				_id = value;
			}

		}
			
		public virtual string VoucherNo
		{
			get
			{ 
				return _voucher_no;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for VoucherNo", value, value.ToString());
				
				_voucher_no = value;
			}
		}
			
		public virtual string InvoiceNo
		{
			get
			{ 
				return _invoice_no;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for InvoiceNo", value, value.ToString());
				
				_invoice_no = value;
			}
		}
			
		public virtual DateTime? DateCreate
		{
			get
			{ 
				return _date_create;
			}
			set
			{
				_date_create = value;
			}

		}
			
		public virtual string Status
		{
			get
			{ 
				return _status;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Status", value, value.ToString());
				
				_status = value;
			}
		}
			
		public virtual double IncomingUsd
		{
			get
			{ 
				return _incoming_usd;
			}
			set
			{
				_incoming_usd = value;
			}

		}
			
		public virtual double OutgoingUsd
		{
			get
			{ 
				return _outgoing_usd;
			}
			set
			{
				_outgoing_usd = value;
			}

		}
			
		public virtual double IncomingVnd
		{
			get
			{ 
				return _incoming_vnd;
			}
			set
			{
				_incoming_vnd = value;
			}

		}
			
		public virtual double OutgoingVnd
		{
			get
			{ 
				return _outgoing_vnd;
			}
			set
			{
				_outgoing_vnd = value;
			}

		}
			
		public virtual string Remark
		{
			get
			{ 
				return _remark;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
		public virtual string UserId
		{
			get
			{ 
				return _user_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for UserId", value, value.ToString());
				
				_user_id = value;
			}
		}
			
		public virtual DateTime? DateInput
		{
			get
			{ 
				return _date_input;
			}
			set
			{
				_date_input = value;
			}

		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			VoucherHistory castObj = (VoucherHistory)obj; 
			return ( castObj != null ) &&
				( this._id == castObj.Id );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(VoucherHistory other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._id == other.Id );
				   
		}

		#endregion
		
	}
}
